<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <link rel="stylesheet" href="../../css/style.css">
    <title>交易订单</title>
    <style>
     .print h3{text-align: center;}
     .print .orderInfo ul{display: inline-block;list-style-type: none;}
     table,table tr th ,td{color:#000;border: none !important;border-top:1px solid #000 !important;border-bottom:1px solid #000 !important;}
    </style>
</head>
<body>
          <div class="container-fluid">
            <div class="row">
                <!-- left print -->
                <div class="col-md-2">
                    <button class="print-link no-print" onclick="jQuery.print()"><span><i class="glyphicon glyphicon-print"></i></span>打印</button>
                </div>
                <!-- right printcontent -->
                <div class="col-md-10">
                        <div class="print">

                            </div>
                </div>
            </div>
          </div>
    <script src="../../js/jquery.min.js" charset="utf-8"></script>
    <script src="../../js/bootstrap.min.js" charset="utf-8"></script>
     <script src="../../plugin/layer/layer.js" charset="utf-8"></script>
    <script src="../../plugin/wangEditor/release/wangEditor.min.js" charset="utf-8"></script>
    <script src="../../js/common.js" charset="utf-8"></script>
    <script src="../../js/bootstrap-paginator.js" charset="utf-8"></script>
    <script src="../../js/ajax.js" charset="utf-8"></script>
    <script src="../../js/jQuery.print.js"></script>
    <script type="text/javascript">

        $(document).ready(function(){
            getOrderPrintData()
        })
        var orderDetailId = window.location.href.split('=')[1];

        function getOrderPrintData(){
        var pageUrls = cncbk_common_tools.serverURL + '/business/order/getOrderPrintData';
        data={'orderDetailId':orderDetailId}

        var func = function (res){
            $('.print').empty();
            var html ='';
            html +='<h3>自营商店 发货单</h3>'+
            '<div class="orderInfo">'+
            '<ul>'+
            '<li>收货人：'+ res.data.name+'</li>'+
            '<li>电话：'+ res.data.phone+'</li>'+
            '<li>下单时间：'+ res.data.orderTime+'</li>'+
            '</ul>'+
            '<ul>'+
            '<li>订单号：'+ res.data.orderSn+'</li>'+
            '<li>&nbsp;</li>'+
            '<li>地址：'+ res.data.province+'</li>'+
            '</ul>'+
            '</div>'+
            '<table class="table table-bordered">'+
            '<thead>'+
            '<tr>'+
            '<th class="col-md-1">序号</th>'+
            '<th >商品名称</th>'+
            '<th class="col-md-1">单价</th>'+
            '<th class="col-md-1">数量</th>'+
            '<th class="col-md-1">小计（元）</th>'+
            '</tr>'+
            '</thead>'+
            '<tbody>'+
            '<tr>'+
            '<td>1</td>'+
            '<td>'+ res.data.goodsName+'</td>'+
            '<td> ￥'+ res.data.goodsPrice+'</td>'+
            '<td>'+ res.data.goodsQuantity+'</td>'+
            '<td>￥'+ res.data.goodsAmount+'</td>'+
            '</tr>'+
            '</tbody>'+
            '<tfoot>'+
            '<tr>'+
            '<th></th>'+
            '<th>合计</th>'+
            '<th>￥'+ res.data.goodsPrice+'</th>'+
            '<th>'+ res.data.goodsQuantity+'</th>'+
            '<th>￥'+ res.data.goodsAmount+'</th>'+
            '</tr>'+
            '<tr>'+
            '<td></td>'+
            '<td>总计：￥'+ res.data.goodsAmount+'元<br>'+
            '店铺：自营店铺'+
            '</td>'+
            '<td colspan="2">运费：￥'+ res.data.goodsFreight+'元</td>'+
            '<td>订单总金额:￥'+ res.data.goodsAmount+'元</td>'+
            '</tr>'+
            '</tfoot>'+
            '</table>';

            $('.print').append(html);
        }


        ajax(
            pageUrls,
            data,
            func,
            'post',
            'json'
        )
    }

        //打印
        $(".print").find('button').on('click', function() {
                $(".print").print({
                    globalStyles : false,
                    mediaPrint : false,
                    // stylesheet : "http://fonts.useso.com/css?family=Inconsolata",
                    iframe : false,
                    noPrintSelector : ".avoid-this",
                    prepend : "Hello World!!!<br/>",
                    append : "<br/>Buh Bye!"
                });
            });
    </script>
</body>
</html>
